﻿<%@ Page Title="" Language="C#" MasterPageFile="~/SIPO.master" AutoEventWireup="false"
    CodeFile="rptCreditlist.aspx.cs" Inherits="SIPO.Web.lists.Report.rptPenerimaanlist" %>

<asp:Content ID="ctnBody" ContentPlaceHolderID="body" runat="server">
    <script src="<%= ResolveUrl("~/scripts/jquery.validate.min.js") %>" type="text/javascript"></script>
    <script src="<%= ResolveUrl("~/scripts/jquery.validate.wrapper.js") %>" type="text/javascript"></script>
    <script src="<%= ResolveUrl("~/scripts/helper.js") %>" type="text/javascript"></script>
    <style type="text/css">
        .ui-autocomplete
        {
            max-height: 100px;
            overflow-y: auto; /* prevent horizontal scrollbar */
            overflow-x: hidden; /* add padding to account for vertical scrollbar */
            padding-right: 20px;
        }
        .custom-combobox
        {
            position: relative;
            display: inline-block;
        }
        .custom-combobox-toggle
        {
            position: absolute;
            top: 0;
            bottom: 0;
            margin-left: -1px;
            padding: 0; /* support: IE7 */
            height: 1.7em;
            top: 0.1em;
        }
        .custom-combobox-input
        {
            margin: 0;
            padding: 0.3em;
        }
    </style>
    <%--   <script type="text/javascript">
        (function ($) {
            $.widget("custom.combobox", {
                _create: function () {
                    this.wrapper = $("<span>")
.addClass("custom-combobox")
.insertAfter(this.element);
                    this.element.hide();
                    this._createAutocomplete();
                    this._createShowAllButton();
                },
                _createAutocomplete: function () {
                    var selected = this.element.children(":selected"),
value = selected.val() ? selected.text() : "";
                    this.input = $("<input>")
.appendTo(this.wrapper)
.val(value)
.attr("title", "")
.addClass("custom-combobox-input ui-widget ui-widget-content ui-state-default ui-corner-left")
.autocomplete({
    delay: 0,
    minLength: 0,
    source: $.proxy(this, "_source")
})
.tooltip({
    tooltipClass: "ui-state-highlight"
});
                    this._on(this.input, {
                        autocompleteselect: function (event, ui) {
                            ui.item.option.selected = true;
                            this._trigger("select", event, {
                                item: ui.item.option
                            });
                        },
                        autocompletechange: "_removeIfInvalid"
                    });
                },
                _createShowAllButton: function () {
                    var input = this.input,
wasOpen = false;
                    $("<a>")
.attr("tabIndex", -1)
.attr("title", "Menampilkan semua data")
.tooltip()
.appendTo(this.wrapper)
.button({
    icons: {
        primary: "ui-icon-triangle-1-s"
    },
    text: false
})
.removeClass("ui-corner-all")
.addClass("custom-combobox-toggle ui-corner-right")
.mousedown(function () {
    wasOpen = input.autocomplete("widget").is(":visible");
})
.click(function () {
    input.focus();
    // Close if already visible
    if (wasOpen) {
        return;
    }
    // Pass empty string as value to search for, displaying all results
    input.autocomplete("search", "");
});
                },
                _source: function (request, response) {
                    var matcher = new RegExp($.ui.autocomplete.escapeRegex(request.term), "i");
                    response(this.element.children("option").map(function () {
                        var text = $(this).text();
                        if (this.value && (!request.term || matcher.test(text)))
                            return {
                                label: text,
                                value: text,
                                option: this
                            };
                    }));
                },
                _removeIfInvalid: function (event, ui) {
                    // Selected an item, nothing to do
                    if (ui.item) {
                        return;
                    }
                    // Search for a match (case-insensitive)
                    var value = this.input.val(),
valueLowerCase = value.toLowerCase(),
valid = false;
                    this.element.children("option").each(function () {
                        if ($(this).text().toLowerCase() === valueLowerCase) {
                            this.selected = valid = true;
                            return false;
                        }
                    });
                    // Found a match, nothing to do
                    if (valid) {
                        return;
                    }
                    // Remove invalid value
                    this.input
.val("")
.attr("title", "\"" + value + "\"" + " tidak ditemukan")
.tooltip("open");
                    this.element.val("");
                    this._delay(function () {
                        this.input.tooltip("close").attr("title", "");
                    }, 2500);
                    this.input.data("ui-autocomplete").term = "";
                },
                _destroy: function () {
                    this.wrapper.remove();
                    this.element.show();
                }
            });
        })(jQuery);
        $(function () {
            $("#<%= ddlJenisPungutan.ClientID %>").combobox();
            $("#toggle").click(function () {
                $("#<%= ddlJenisPungutan.ClientID %>").toggle();
            });
        });
    </script> --%>
    <script type="text/javascript">
        $("#btnCancel").button({ icons: { primary: "ui-icon-close"} });
        $("#<%=Button1 %>").button({ icons: { primary: "ui-icon-print"} });
    </script>
    <script type="text/javascript">



        function pisahkan(control) {
            var list = control;
            var temp = [];
            var temp1 = [];
            temp = list.split(',');
            if (temp.length > 0) {
                for (i = 0; i < temp.length - 1; i++) {
                    temp1.push(temp[i].split('-', 1));
                }
            }
            var gabung = temp1.join(',');
            return gabung;
        }
        $(function () {
            //populate data sector

            var listSektor = [];
            //listSektor.push('Semua');
            var handlerUrlSector = '<%= ResolveUrl("~/AjaxHandler/Loaddata/getsector.ashx?method=getsubsubsectorIDsLogin") %>';

            $.ajax({
                type: 'POST',
                url: handlerUrlSector,
                contentType: 'application/json',
                dataType: 'json',
                success: function (datas) {
                    //alert(datas.length);
                    if (datas.length > 1) {
                        listSektor.push('Semua');
                    }
                    $.each(datas, function (i, data) {
                        listSektor.push(data.SectorCode + "-" + data.SectorName);
                    });
                },
                error: function () {
                    alert('Error getSector!');
                }
            });

            function split(val) {
                return val.split(/,\s*/);
            }
            function extractLast(term) {
                return split(term).pop();
            }


            $("#txtSektor")
            // don't navigate away from the field on tab when selecting an item
			.bind("keydown", function (event) {
			    //alert(availableTags);
			    if (event.keyCode === $.ui.keyCode.TAB &&
						$(this).data("ui-autocomplete").menu.active) {
			        event.preventDefault();
			    }
			})
			.autocomplete({
			    minLength: 0,
			    source: function (request, response) {
			        // delegate back to autocomplete, but extract the last term
			        response($.ui.autocomplete.filter(
						listSektor, extractLast(request.term)));
			    },
			    focus: function () {
			        // prevent value inserted on focus
			        return false;
			    },
			    select: function (event, ui) {
			        var terms = split(this.value);
			        // remove the current input
			        terms.pop();
			        // add the selected item
			        terms.push(ui.item.value);
			        // add placeholder to get the comma-and-space at the end
			        terms.push("");
			        this.value = terms.join(", ");
			        return false;
			    }
			});
        });
    </script>
    <script type="text/javascript">
        $(document).ready(function () {
            $('#btnCancel').click(function () {
                $('#cbDetail').attr('checked', false);
                $('#txtSektor').val('');
                $('#txtSubSektor').val('');
                $('#txtSubSubSektor').val('');
                $('#txtPeriodeAwal').val('');
                $('#txtPeriodeAkhir').val('');
                $('#<%= ddlJenisPungutan.ClientID %>').val('');
                // $('#<%= ddlJenisPungutan.ClientID %>').combobox('autocomplete', "", "");
            });
            //           if ($('#txtSektor').val() == '') {
            //               $('#cbDetail').attr('checked', false);
            //               $('#txtSektor').val('pilih sektor...');
            //               $('#txtSubSektor').val('pilih sub sektor...');
            //               $('#txtSubSubSektor').val('pilih sub sub sektor...');
            //               $('#txtPeriodeAwal').val('Periode Awal');
            //               $('#txtPeriodeAkhir').val('Periode Akhir');
            //               $('#<%= ddlJenisPungutan.ClientID %>').val('-- jenis pungutan --');
            //           }

            if ($('#<%= hfSektorID.ClientID %>').val() != "")
                $('#txtSektor').val($('#<%= hfSektorID.ClientID %>').val());
            if ($('#<%= hfSubSektorID.ClientID %>').val() != "")
                $('#txtSubSektor').val($('#<%= hfSubSektorID.ClientID %>').val());
            if ($('#<%= hfSubSubSektorID.ClientID %>').val() != "")
                $('#txtSubSubSektor').val($('#<%= hfSubSubSektorID.ClientID %>').val());
            //            if ($('#<%= hfTransTypeID.ClientID %>').val()!="")
            //                $('#<%= ddlJenisPungutan.ClientID %>').val($('#<%= hfTransTypeID.ClientID %>').val());
            if ($('#<%= hfPeriodeAwal.ClientID %>').val() != "")
                $('#txtPeriodeAwal').val($('#<%= hfPeriodeAwal.ClientID %>').val());
            if ($('#<%= hfPeriodeAkhir.ClientID %>').val() != "")
                $('#txtPeriodeAkhir').val($('#<%= hfPeriodeAkhir.ClientID %>').val());

            var detail = $('#<%= hfDetail.ClientID %>').val();
            if (detail == 1)
                $('#cbDetail').attr('checked', true);
            // alert("a");
            //           biasa();
            //           function biasa() {
            //               $('#cbDetail').attr('checked', false);
            //               $('#txtSektor').val('pilih sektor...');
            //               $('#txtSubSektor').val('pilih sub sektor...');
            //               $('#txtSubSubSektor').val('pilih sub sub sektor...');
            //               $('#txtPeriodeAwal').val('Periode Awal');
            //               $('#txtPeriodeAkhir').val('Periode Akhir');
            //               $('#<%= ddlJenisPungutan.ClientID %>').val('-- jenis pungutan --');
            //           }



            $('#txtSubSektor').focus(function () {
                //$('#txtSektor').change(function () {
                var temp = "";
                if ($('#txtSektor').val() == "Semua, ") {
                    var handlerUrlSector = '<%= ResolveUrl("~/AjaxHandler/Loaddata/getsector.ashx?method=getsubsubsectorIDsLogin") %>';

                    $.ajax({
                        type: 'POST',
                        url: handlerUrlSector,
                        contentType: 'application/json',
                        dataType: 'json',
                        success: function (datas) {
                            $.each(datas, function (i, data) {
                                temp += data.SectorCode + "-" + data.SectorName + ", ";
                            });
                            $('#txtSektor').val(temp);
                            $('#txtSektor').focus();
                            $('#txtSubSektor').focus();
                        },
                        error: function () {
                            alert('Error getSector ambil semua!');
                        }
                    });
                }

                $(function () {
                    var list = $('#txtSektor').val();
                    //populate data sub sector
                    var listSubSektor = [];
                    var parameter;
                    //listSubSektor.push('Semua');
                    var temp = [];
                    var temp1 = [];

                    if (list == "pilih sektor..." || list == "") {
                        alert("data sektor harus diisi!");
                        $('#txtSektor').focus();
                        $('#txtSubSektor').val('pilih sub sektor...');
                    } else {
                        if ($('#txtSubSektor').val().toString().toLowerCase().indexOf('pilih') > -1)
                            $('#txtSubSektor').val('');
                        var gabung = pisahkan(list);
                        parameter = "where recSector.SectorCode in(" + gabung + ")";


                        var handlerUrlSubSector = '<%= ResolveUrl("~/AjaxHandler/Loaddata/getsubsector.ashx?method=multipleSectorID&param=' + parameter + '") %>';

                        $.ajax({
                            type: 'POST',
                            url: handlerUrlSubSector,
                            contentType: 'application/json',
                            dataType: 'json',
                            success: function (datas) {
                                if (datas.length > 1) {
                                    listSubSektor.push('Semua');
                                }
                                $.each(datas, function (i, data) {
                                    listSubSektor.push(data.recSector.SectorCode + "." + data.SubSectorCode + "-" + data.SubSectorName);
                                });
                            },
                            error: function () {
                                //  alert('error ambil data sub sektor');
                                // $('#txtSektor').focus();
                                //  $('#txtSubSektor').val('pilih sub sektor...');
                            }
                        });

                        function split(val) {
                            return val.split(/,\s*/);
                        }
                        function extractLast(term) {
                            return split(term).pop();
                        }


                        $("#txtSubSektor")
                        // don't navigate away from the field on tab when selecting an item
			.bind("keydown", function (event) {
			    //alert(availableTags);
			    if (event.keyCode === $.ui.keyCode.TAB &&
						$(this).data("ui-autocomplete").menu.active) {
			        event.preventDefault();
			    }
			})
			.autocomplete({
			    minLength: 0,
			    source: function (request, response) {
			        // delegate back to autocomplete, but extract the last term
			        response($.ui.autocomplete.filter(
						listSubSektor, extractLast(request.term)));
			    },
			    focus: function () {
			        // prevent value inserted on focus
			        return false;
			    },
			    select: function (event, ui) {
			        var terms = split(this.value);
			        // remove the current input
			        terms.pop();
			        // add the selected item
			        terms.push(ui.item.value);
			        // add placeholder to get the comma-and-space at the end
			        terms.push("");
			        this.value = terms.join(", ");
			        return false;
			    }
			});
                    }
                });
            });

        });
    </script>
    <script type="text/javascript">
        $(document).ready(function () {
            //           function CekData() {

            //           }
            $('#txtSubSubSektor').focus(function () {
                var temp = "";
                if ($('#txtSubSektor').val() == "Semua, ") {
                    var gabung = pisahkan($('#txtSektor').val());
                    parameter = "where recSector.SectorCode in(" + gabung + ")";
                    var handlerUrlSubSector = '<%= ResolveUrl("~/AjaxHandler/Loaddata/getsubsector.ashx?method=multipleSectorID&param=' + parameter + '") %>';

                    $.ajax({
                        type: 'POST',
                        url: handlerUrlSubSector,
                        contentType: 'application/json',
                        dataType: 'json',
                        success: function (datas) {
                            $.each(datas, function (i, data) {
                                temp += data.recSector.SectorCode + "." + data.SubSectorCode + "-" + data.SubSectorName + ", ";
                                //    listSubSektor.push(data.recSector.SectorCode + "." + data.SubSectorCode + "-" + data.SubSectorName);

                            });
                            $('#txtSubSektor').val(temp);
                            $('#txtSubSektor').focus();
                            $('#txtSubSubSektor').focus();
                        },
                        error: function () {
                            alert('Error getSubSector ambil semua!');
                        }
                    });
                }

                $(function () {
                    var listSector = $('#txtSektor').val();
                    var listSubSector = $('#txtSubSektor').val();
                    var parameter;
                    //populate data sub sub sector
                    var listSubSubSektor = [];
                    //listSubSubSektor.push('Semua');

                    if (listSector == "pilih sektor..." || listSector == "" || listSubSector == "pilih sub sektor" || listSubSector == "") {
                        $('#txtSektor').focus();
                        alert("data sektor/sub sektor harus diisi dahulu!");
                    } else {
                        if ($('#txtSubSubSektor').val().toString().toLowerCase().indexOf('pilih') > -1)
                            $('#txtSubSubSektor').val('');
                        var gabungSector = pisahkan(listSector);
                        var gabungSubSector = pisahkan(listSubSector);
                        parameter = gabungSector;
                        parameter += "-" + gabungSubSector;


                        var handlerUrlSubSector = '<%= ResolveUrl("~/AjaxHandler/Loaddata/getsubsubsector.ashx?method=multipleSubSubSectorID&param=' + parameter + '") %>';

                        $.ajax({
                            type: 'POST',
                            url: handlerUrlSubSector,
                            contentType: 'application/json',
                            dataType: 'json',
                            success: function (datas) {
                                if (datas.length > 1) {
                                    listSubSubSektor.push('Semua');
                                }
                                $.each(datas, function (i, data) {
                                    listSubSubSektor.push(data.recSubSector.recSector.SectorCode + "." + data.recSubSector.SubSectorCode + "." + data.SubSubSectorCode + "-" + data.SubSubSectorName);
                                });
                            },
                            error: function () {
                                alert('Anda wajib mengisi data sektor/sub sektor terlebih dahulu!');
                                $('#txtSubSektor').val();
                                $('#txtSubSektor').focus();
                                $('#txtSubSubSektor').val('pilih sub sub sektor...');
                            }
                        });

                        function split(val) {
                            return val.split(/,\s*/);
                        }
                        function extractLast(term) {
                            return split(term).pop();
                        }


                        $("#txtSubSubSektor")
                        // don't navigate away from the field on tab when selecting an item
			.bind("keydown", function (event) {
			    //alert(availableTags);
			    if (event.keyCode === $.ui.keyCode.TAB &&
						$(this).data("ui-autocomplete").menu.active) {
			        event.preventDefault();
			    }
			})
			.autocomplete({
			    minLength: 0,
			    source: function (request, response) {
			        // delegate back to autocomplete, but extract the last term
			        response($.ui.autocomplete.filter(
						listSubSubSektor, extractLast(request.term)));
			    },
			    focus: function () {
			        // prevent value inserted on focus
			        return false;
			    },
			    select: function (event, ui) {
			        var terms = split(this.value);
			        // remove the current input
			        terms.pop();
			        // add the selected item
			        terms.push(ui.item.value);
			        // add placeholder to get the comma-and-space at the end
			        terms.push("");
			        this.value = terms.join(", ");
			        return false;
			    }
			});
                    }
                });
            });
        });
    </script>
    <h2>
        Laporan Piutang</h2>
    <table>
        <tr>
            <td style="width: 50">
                Sektor
            </td>
            <td>
                :
            </td>
            <td>
                <input type="text" id="txtSektor" size="75" />
            </td>
        </tr>
        <tr>
            <td style="width: 50">
                Sub Sektor
            </td>
            <td>
                :
            </td>
            <td>
                <input type="text" id="txtSubSektor" size="75" />
            </td>
        </tr>
        <tr>
            <td style="width: 50">
                Sub Sub Sektor
            </td>
            <td>
                :
            </td>
            <td>
                <input type="text" id="txtSubSubSektor" size="75" />
            </td>
        </tr>
        <tr>
            <td style="width: 50">
                Jenis Pungutan
            </td>
            <td>
                :
            </td>
            <td>
                <asp:DropDownList ID="ddlJenisPungutan" runat="server" Width="200">
                </asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td style="width: 50">
                Penampilan Informasi
            </td>
            <td>
                :
            </td>
            <td>
                <input type="checkbox" id="cbDetail" />Detail
            </td>
        </tr>
        <tr>
            <td style="width: 50">
                Periode
            </td>
            <td>
                :
            </td>
            <td>
                <input type="text" id="txtPeriodeAwal" />&nbsp;<span style="color: Red;">*</span>
                -
                <input type="text" id="txtPeriodeAkhir" />&nbsp;<span style="color: Red;">*</span>
            </td>
        </tr>
        <tr>
            <td colspan="2">
                &nbsp;
            </td>
            <td>
                <div style="text-align: right; padding-top: 10px;">
                    <asp:Button ID="Button1" runat="server" Text="Cetak" OnClick="Button1_Click" />
                    &nbsp;&nbsp;
                    <input type="button" id="btnCancel" value="Batal" />
                </div>
            </td>
        </tr>
    </table>
    <asp:HiddenField ID="hfSektorID" runat="server" />
    <asp:HiddenField ID="hfSubSektorID" runat="server" />
    <asp:HiddenField ID="hfSubSubSektorID" runat="server" />
    <asp:HiddenField ID="hfTransTypeID" runat="server" />
    <asp:HiddenField ID="hfPeriodeAwal" runat="server" />
    <asp:HiddenField ID="hfPeriodeAkhir" runat="server" />
    <asp:HiddenField ID="hfDetail" runat="server" />
    <br />
    <br />
    <div>
        <asp:ScriptManager ID="scManager" runat="server" EnablePartialRendering="true">
        </asp:ScriptManager>
        <rsweb:ReportViewer OnDrillthrough="rsViewer_Drillthrough" ID="rsViewer" runat="server"
            Height="100%" SizeToReportContent="true" Width="100%" HyperlinkTarget="_blank"
            AsyncRendering="False" KeepSessionAlive="False">
        </rsweb:ReportViewer>
    </div>
    <script type="text/javascript">
        $(document).ready(function () {

            var rules = {
                '<%= hfPeriodeAwal.UniqueID %>': "required",
                '<%= hfPeriodeAkhir.UniqueID %>': "required"
            };

            var messages = {
                '<%= hfPeriodeAwal.UniqueID %>': "Periode Awal harus di isi",
                '<%= hfPeriodeAkhir.UniqueID %>': "Periode Akhir harus di isi"
            };
            // 2. Initiate the validator
            var validator = new jQueryValidatorWrapper("frmMasterPage", rules, messages);

            $('#<%= Button1.ClientID %>').click(function () {

                $('#<%= hfPeriodeAwal.ClientID %>').val($('#txtPeriodeAwal').val());
                $('#<%= hfPeriodeAkhir.ClientID %>').val($('#txtPeriodeAkhir').val());
                if (!validator.validate())
                    return;

                $('#<%= hfSektorID.ClientID %>').val($('#txtSektor').val());
                $('#<%= hfSubSektorID.ClientID %>').val($('#txtSubSektor').val());
                $('#<%= hfSubSubSektorID.ClientID %>').val($('#txtSubSubSektor').val());
                $('#<%= hfTransTypeID.ClientID %>').val($('#<%= ddlJenisPungutan.ClientID %>').val());
                //                $('#<%= hfPeriodeAwal.ClientID %>').val($('#txtPeriodeAwal').val());
                //                $('#<%= hfPeriodeAkhir.ClientID %>').val($('#txtPeriodeAkhir').val());

                var detail = $('#cbDetail').is(':checked') ? 1 : 0;
                $('#<%= hfDetail.ClientID %>').val(detail);
            });

            $('#txtSektor').keyup(function () {
                var temp = "";
                if ($('#txtSektor').val() == "Semua, ") {
                    var handlerUrlSector = '<%= ResolveUrl("~/AjaxHandler/Loaddata/getsector.ashx?method=getsubsubsectorIDsLogin") %>';

                    $.ajax({
                        type: 'POST',
                        url: handlerUrlSector,
                        contentType: 'application/json',
                        dataType: 'json',
                        success: function (datas) {
                            $.each(datas, function (i, data) {
                                temp += data.SectorCode + "-" + data.SectorName + ", ";
                            });
                            $('#txtSektor').val(temp);
                        },
                        error: function () {
                            alert('Error getSector ambil semua!');
                        }
                    });
                }
            });



            $('#txtSubSektor').keyup(function () {
                var temp = "";
                if ($('#txtSubSektor').val() == "Semua, ") {
                    var gabung = pisahkan($('#txtSektor').val());
                    parameter = "where recSector.SectorCode in(" + gabung + ")";
                    var handlerUrlSubSector = '<%= ResolveUrl("~/AjaxHandler/Loaddata/getsubsector.ashx?method=multipleSectorID&param=' + parameter + '") %>';

                    $.ajax({
                        type: 'POST',
                        url: handlerUrlSubSector,
                        contentType: 'application/json',
                        dataType: 'json',
                        success: function (datas) {
                            $.each(datas, function (i, data) {
                                temp += data.recSector.SectorCode + "." + data.SubSectorCode + "-" + data.SubSectorName + ", ";
                                //    listSubSektor.push(data.recSector.SectorCode + "." + data.SubSectorCode + "-" + data.SubSectorName);

                            });
                            $('#txtSubSektor').val(temp);
                        },
                        error: function () {
                            alert('Error getSubSector ambil semua!');
                        }
                    });
                }
            });

            $('#txtSubSubSektor').keyup(function () {
                var temp = "";
                if ($('#txtSubSubSektor').val() == "Semua, ") {
                    var gabungSector = pisahkan($('#txtSektor').val());
                    var gabungSubSector = pisahkan($('#txtSubSektor').val());
                    //                    parameter = "where recSector.SectorCode in(" + gabungSector + ")";
                    //                    parameter += " and recSubSector.SubSectorCode in(" + gabungSubSector + ")";
                    parameter = gabungSector;
                    parameter += "-" + gabungSubSector;

                    var handlerUrlSubSubSector = '<%= ResolveUrl("~/AjaxHandler/Loaddata/getsubsubsector.ashx?method=multipleSubSubSectorID&param=' + parameter + '") %>';

                    $.ajax({
                        type: 'POST',
                        url: handlerUrlSubSubSector,
                        contentType: 'application/json',
                        dataType: 'json',
                        success: function (datas) {
                            $.each(datas, function (i, data) {
                                temp += data.recSubSector.recSector.SectorCode + "." + data.recSubSector.SubSectorCode + "." + data.SubSubSectorCode + "-" + data.SubSubSectorName + ", ";
                                //  listSubSubSektor.push(data.recSubSector.recSector.SectorCode + "." + data.recSubSector.SubSectorCode + "." + data.SubSubSectorCode + "-" + data.SubSubSectorName);

                            });
                            $('#txtSubSubSektor').val(temp);
                        },
                        error: function () {
                            alert('Error getSubSubSector ambil semua!');
                        }
                    });
                }
            });


            var countSektor = 0;
            var countSubSektor = 0;
            var countSubSubSektor = 0;


            $('#txtSektor').focus(function () {
                if (countSektor == 0) {
                    $('#txtSektor').val('');
                    countSektor++;
                }
            });

            $('#txtSubSektor').focus(function () {
                if (countSubSektor == 0) {
                    $('#txtSubSektor').val('');
                    countSubSektor++;
                }
            });

            $('#txtSubSubSektor').focus(function () {
                if (countSubSubSektor == 0) {
                    $('#txtSubSubSektor').val('');
                    countSubSubSektor++;
                }
            });

            $("#txtPeriodeAwal").datepicker({ showWeek: true, showButtonPanel: true,
                changeMonth: true, changeYear: true, dateFormat: 'dd/mm/yy',
                numberOfMonths: 1,
                onSelect: function (selected) {
                    $("#txtPeriodeAkhir").datepicker("option", "minDate", selected)
                }
            });

            $("#txtPeriodeAkhir").datepicker({ showWeek: true, showButtonPanel: true,
                changeMonth: true, changeYear: true, dateFormat: 'dd/mm/yy',
                numberOfMonths: 1,
                onSelect: function (selected) {
                    $("#txtPeriodeAwal").datepicker("option", "maxDate", selected)
                }
            });

            $('#btnNextx').click(function () {
                var sectorID = $('#txtSektor').val() == "pilih sektor..." ? "" : $('#txtSektor').val();
                var subSectorID = $('#txtSubSektor').val() == "pilih sub sektor..." ? "" : $('#txtSubSektor').val(); ;
                var subSubSectorID = $('#txtSubSubSektor').val() == "pilih sub sub sektor..." ? "" : $('#txtSubSubSektor').val(); ;
                var transTypeID = $('#<%= ddlJenisPungutan.ClientID %>').val();
                var periodeAwal = $('#txtPeriodeAwal').val() == "Periode Awal" ? "" : $('#txtPeriodeAwal').val();
                var periodeAkhir = $('#txtPeriodeAkhir').val() == "Periode Akhir" ? "" : $('#txtPeriodeAkhir').val();
                var detail = 0;

                if ($('#cbDetail').is(':checked'))
                    detail = 1;

                window.location = "rptPenerimaanlist.aspx?SectorID=" + sectorID + "&SubSectorID=" + subSectorID + "&SubSubSectorID=" + subSubSectorID + "&TransTypeID=" + transTypeID + "&PeriodeAwal=" + periodeAwal + "&PeriodeAkhir=" + periodeAkhir + "&Detail=" + detail;
            });





        });
    </script>
</asp:Content>
